home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performSetCurrentUVSet.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.2 KB  |  122 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17.  
  18. proc setOptionVars (int $forceFactorySettings)
  19. {               
  20.     if ($forceFactorySettings || !`optionVar -exists polyCurrentUVSet`)
  21.         optionVar -stringValue polyCurrentUVSet "";
  22. }
  23.  
  24. global proc performSetCurrentUVSetSetup (string $parent, 
  25.                                          int $forceFactorySettings)
  26. {
  27.     setOptionVars($forceFactorySettings);
  28.     setParent $parent;
  29.  
  30.     string $sval;
  31.     $sval = `optionVar -query polyCurrentUVSet`;
  32.     textFieldGrp -edit -tx $sval polyCurrentUVSet;
  33. }
  34.  
  35. global proc performSetCurrentUVSetCallback (string $parent, int $doIt)
  36. {
  37.     setParent $parent;
  38.  
  39.     optionVar -stringValue polyCurrentUVSet
  40.         `textFieldGrp -query -tx polyCurrentUVSet`;
  41.  
  42.     if ($doIt) {
  43.         performSetCurrentUVSet 0;
  44.         addToRecentCommandQueue "performSetCurrentUVSet 0" "SetCurrentUVSet";
  45.     }
  46. }
  47.  
  48. proc polySetCurrentUVSetOptions()
  49. {
  50.     string $commandName = "performSetCurrentUVSet";
  51.     string $callback = ($commandName + "Callback");
  52.     string $setup = ($commandName + "Setup");
  53.        
  54.     string $layout = getOptionBox();
  55.     setParent $layout;
  56.     setUITemplate -pushTemplate DefaultTemplate;
  57.     waitCursor -state 1;
  58.  
  59.     string $parent = `columnLayout -adjustableColumn true`;
  60.     
  61.     textFieldGrp -label "UV Set Name: " polyCurrentUVSet;
  62.  
  63.     setParent $parent;
  64.  
  65.     waitCursor -state 0;
  66.     setUITemplate -popTemplate;
  67.        
  68.     string $applyBtn = getOptionBoxApplyBtn();
  69.     button -edit -label "Set Current"
  70.            -command ($callback + " " + $parent + " " + 1)
  71.         $applyBtn;
  72.  
  73.     string $saveBtn = getOptionBoxSaveBtn();
  74.     button -edit 
  75.         -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
  76.         $saveBtn;
  77.  
  78.     string $resetBtn = getOptionBoxResetBtn();
  79.     button -edit 
  80.         -command ($setup + " " + $parent + " " + 1)
  81.         $resetBtn;
  82.              
  83.     setOptionBoxTitle("Set Current UV Set Options");
  84.  
  85.     setOptionBoxHelpTag( "SetCurrentUVSet" );
  86.  
  87.     eval (($setup + " " + $parent + " " + 0));      
  88.     showOptionBox();
  89. }
  90.  
  91. global proc string performSetCurrentUVSet (int $option)
  92. {
  93.     string $cmd="polyUVSet -currentUVSet -uvSet ";
  94.     switch ($option) 
  95.     {
  96.  
  97.       case 1: polySetCurrentUVSetOptions; 
  98.         // Just the option box
  99.         break;
  100.         
  101.       default:
  102.         setOptionVars(false);
  103.         string $name = `optionVar -query polyCurrentUVSet`;
  104.  
  105.         if (size($name))
  106.         {
  107.             $cmd += ("\"" + $name + "\"");
  108.             if ($option == 0)
  109.                 evalEcho $cmd;
  110.         }
  111.         else
  112.         {
  113.             if ($option == 0)
  114.                 warning "No name specified to set current uvset to.";
  115.         }
  116.         break;
  117.     }
  118.     return $cmd;
  119. }
  120.  
  121.  
  122.